<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>embedme: src/Timer.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">embedme
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">Timer.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_timer_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/******************************************************************************</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * This file is part of libemb.</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * libemb is free software: you can redistribute it and/or modify</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * it under the terms of the GNU General Public License as published by</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * the Free Software Foundation, either version 3 of the License, or</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * (at your option) any later version.</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * libemb is distributed in the hope that it will be useful,</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> * GNU General Public License for more details.</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> * You should have received a copy of the GNU General Public License</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> * along with libemb.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> * Project: Embedme</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> * Author : FergusZeng</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> * Email  : cblock@126.com</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> * git    : https://gitee.com/newgolo/embedme.git</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> * Copyright 2014~2020 @ ShenZhen ,China</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment">*******************************************************************************/</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#ifndef __TIMER_H__</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#define __TIMER_H__</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160; </div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_base_type_8h.html">BaseType.h</a>&quot;</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_thread_8h.html">Thread.h</a>&quot;</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_thread_util_8h.html">ThreadUtil.h</a>&quot;</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_date_time_8h.html">DateTime.h</a>&quot;</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="preprocessor">#include &lt;time.h&gt;</span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#include &lt;list&gt;</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160; </div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="keyword">namespace </span>libemb{</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160; </div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="classlibemb_1_1_timer_listener.html">   44</a></span>&#160;<span class="keyword">class </span><a class="code" href="classlibemb_1_1_timer_listener.html">TimerListener</a>{</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    <a class="code" href="classlibemb_1_1_timer_listener.html">TimerListener</a>(){};</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    <span class="keyword">virtual</span> ~<a class="code" href="classlibemb_1_1_timer_listener.html">TimerListener</a>(){};</div>
<div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="classlibemb_1_1_timer_listener.html#a92d35491cd12d3f8b1fbec1fadfb3f7f">   52</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classlibemb_1_1_timer_listener.html#a92d35491cd12d3f8b1fbec1fadfb3f7f">onTimer</a>(<span class="keywordtype">int</span> timerID)=0;</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;};</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160; </div>
<div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="classlibemb_1_1_timer.html">   59</a></span>&#160;<span class="keyword">class </span><a class="code" href="classlibemb_1_1_timer.html">Timer</a>{</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<a class="code" href="_base_type_8h.html#a57e803e49526dc5ba8c1915c68708ae0">DECL_CLASSNAME</a>(<a class="code" href="classlibemb_1_1_timer.html">Timer</a>)</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <a class="code" href="classlibemb_1_1_timer.html">Timer</a>(<span class="keyword">const</span> <a class="code" href="classlibemb_1_1_timer_listener.html">TimerListener</a>&amp; listener,<span class="keywordtype">int</span> timerID);</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    ~<a class="code" href="classlibemb_1_1_timer.html">Timer</a>();</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classlibemb_1_1_timer.html#a1e01bd9a8f9d9b779c0a89f8d5a60526">start</a>(<span class="keywordtype">int</span> seconds, <span class="keywordtype">int</span> repeats=-1);</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classlibemb_1_1_timer.html#abea390d224f2ac79b3c20ccfa81c0214">stop</a>();</div>
<div class="line"><a name="l00080"></a><span class="lineno"><a class="line" href="classlibemb_1_1_timer.html#aa2d347668ffa5937cd47f4f6fb80b513">   80</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classlibemb_1_1_timer.html#aa2d347668ffa5937cd47f4f6fb80b513">id</a>(){<span class="keywordflow">return</span> m_timerID;}</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;    <span class="keywordtype">void</span> checkAlarm();</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classlibemb_1_1_timer_manager.html">TimerManager</a>;</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    <a class="code" href="classlibemb_1_1_timer_listener.html">TimerListener</a>* m_listener{<span class="keyword">nullptr</span>};</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    Time m_alarmTime;</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    <span class="keywordtype">int</span> m_timerID{0};</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    <span class="keywordtype">int</span> m_repeats{0};</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    <span class="keywordtype">int</span> m_interval{0};</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;    <span class="keywordtype">bool</span> m_startFlag{<span class="keyword">false</span>};</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;};</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160; </div>
<div class="line"><a name="l00097"></a><span class="lineno"><a class="line" href="classlibemb_1_1_timer_manager.html">   97</a></span>&#160;<span class="keyword">class </span><a class="code" href="classlibemb_1_1_timer_manager.html">TimerManager</a>:<span class="keyword">public</span> <a class="code" href="classlibemb_1_1_runnable.html">Runnable</a>,<span class="keyword">public</span> <a class="code" href="classlibemb_1_1_singleton.html">Singleton</a>&lt;TimerManager&gt;{</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;<a class="code" href="_base_type_8h.html#a57e803e49526dc5ba8c1915c68708ae0">DECL_CLASSNAME</a>(<a class="code" href="classlibemb_1_1_timer_manager.html">TimerManager</a>)</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;<a class="code" href="_singleton_8h.html#adbe81dabafd4a18fb17e8780c0a9190d">DECL_SINGLETON</a>(<a class="code" href="classlibemb_1_1_timer_manager.html">TimerManager</a>)</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    ~<a class="code" href="classlibemb_1_1_timer_manager.html">TimerManager</a>();</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classlibemb_1_1_timer_manager.html#a39ce6c9ee541c303d308ebfc3b41499f">registerTimer</a>(<span class="keyword">const</span> <a class="code" href="classlibemb_1_1_timer.html">Timer</a>&amp; timer);</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classlibemb_1_1_timer_manager.html#a0ffd07a8cfe9bb462968e0461e1b87f4">unregisterTimer</a>(<span class="keyword">const</span> <a class="code" href="classlibemb_1_1_timer.html">Timer</a>&amp; timer);</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    <span class="keywordtype">void</span> run();</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    <a class="code" href="classlibemb_1_1_mutex.html">Mutex</a> m_tmrlstMutex;</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    std::unique_ptr&lt;Thread&gt; m_thread{<span class="keyword">nullptr</span>};</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    std::list&lt;Timer*&gt; m_timerList;</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    <span class="keywordtype">bool</span> m_startFlag{<span class="keyword">false</span>};</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;};</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160; </div>
<div class="line"><a name="l00129"></a><span class="lineno"><a class="line" href="classlibemb_1_1_r_timer.html">  129</a></span>&#160;<span class="keyword">class </span><a class="code" href="classlibemb_1_1_r_timer.html">RTimer</a>:<span class="keyword">public</span> <a class="code" href="classlibemb_1_1_runnable.html">Runnable</a>{</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;<a class="code" href="_base_type_8h.html#a57e803e49526dc5ba8c1915c68708ae0">DECL_CLASSNAME</a>(<a class="code" href="classlibemb_1_1_r_timer.html">RTimer</a>)</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;    <a class="code" href="classlibemb_1_1_r_timer.html#a9a1f4ff5d6f67b82aa56cbee440acfe8">RTimer</a>(<span class="keyword">const</span> <a class="code" href="classlibemb_1_1_timer_listener.html">TimerListener</a>&amp; listener,<span class="keywordtype">int</span> <span class="keywordtype">id</span>);</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;    ~<a class="code" href="classlibemb_1_1_r_timer.html">RTimer</a>();</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classlibemb_1_1_r_timer.html#a14a3671120ad948121f756f9f1ed0a40">start</a>(<span class="keywordtype">int</span> usTimeout,<span class="keywordtype">int</span> usTick,<span class="keywordtype">bool</span> repeat=<span class="keyword">false</span>);</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classlibemb_1_1_r_timer.html#a8da735814c1121a8ef1b1af2c4ac0ed7">stop</a>();</div>
<div class="line"><a name="l00156"></a><span class="lineno"><a class="line" href="classlibemb_1_1_r_timer.html#a7baba59b510de9da5458fbda682612c1">  156</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classlibemb_1_1_r_timer.html#a7baba59b510de9da5458fbda682612c1">id</a>(){<span class="keywordflow">return</span> m_timerID;}</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;    <span class="keywordtype">void</span> run();</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;    std::unique_ptr&lt;Thread&gt; m_thread{<span class="keyword">nullptr</span>};</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;    TimerListener* m_listener{<span class="keyword">nullptr</span>};</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;    <span class="keywordtype">bool</span> m_repeat{<span class="keyword">false</span>};</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;    <span class="keywordtype">int</span> m_timerID{0};</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;    <span class="keywordtype">int</span> m_usInterval{0};</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;    <span class="keywordtype">int</span> m_usTick{1};</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;};</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160; </div>
<div class="line"><a name="l00172"></a><span class="lineno"><a class="line" href="classlibemb_1_1_event_timer.html">  172</a></span>&#160;<span class="keyword">class </span><a class="code" href="classlibemb_1_1_event_timer.html">EventTimer</a>:<span class="keyword">public</span> <a class="code" href="classlibemb_1_1_timer_listener.html">TimerListener</a>{</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;<a class="code" href="_base_type_8h.html#a57e803e49526dc5ba8c1915c68708ae0">DECL_CLASSNAME</a>(<a class="code" href="classlibemb_1_1_event_timer.html">EventTimer</a>)</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;<span class="keyword">public</span>: </div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;    <a class="code" href="classlibemb_1_1_event_timer.html#ab3d4af19969a3e9e8509524ca12fdeed">EventTimer</a>(<span class="keywordtype">int</span> usCheck,<span class="keywordtype">int</span> evtMask=-1);</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;    <span class="keyword">virtual</span> ~<a class="code" href="classlibemb_1_1_event_timer.html">EventTimer</a>();</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classlibemb_1_1_event_timer.html#a85ec84b0477b1cf8b7fbb658e193d964">clearEvent</a>();</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classlibemb_1_1_event_timer.html#acd3bda3d463dd9e896ae8efc63d30c4a">waitEvent</a>(std::vector&lt;int&gt; eventList,<span class="keywordtype">int</span> usTimeout);</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classlibemb_1_1_event_timer.html#ae4b1885ff91e6b1216437541cbe0b5b1">meetEvent</a>(<span class="keywordtype">int</span> event);</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;    <span class="keywordtype">void</span> onTimer(<span class="keywordtype">int</span> timerID);</div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;    std::unique_ptr&lt;RTimer&gt; m_timer;</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;    std::vector&lt;int&gt; m_eventList;</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;    <a class="code" href="classlibemb_1_1_mutex_cond.html">MutexCond</a> m_cond;</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;    <span class="keywordtype">bool</span> m_isStart{<span class="keyword">false</span>};</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;    <span class="keywordtype">bool</span> m_isTimeout{<span class="keyword">false</span>};</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;    <span class="keywordtype">int</span> m_event{-1};</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;    <span class="keywordtype">int</span> m_evtMask{-1};</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;    <span class="keywordtype">int</span> m_usCheck{100};</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;};</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160; </div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;}</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclasslibemb_1_1_event_timer_html_ae4b1885ff91e6b1216437541cbe0b5b1"><div class="ttname"><a href="classlibemb_1_1_event_timer.html#ae4b1885ff91e6b1216437541cbe0b5b1">libemb::EventTimer::meetEvent</a></div><div class="ttdeci">void meetEvent(int event)</div><div class="ttdoc">报告事件</div><div class="ttdef"><b>Definition:</b> Timer.cpp:287</div></div>
<div class="ttc" id="aclasslibemb_1_1_timer_manager_html"><div class="ttname"><a href="classlibemb_1_1_timer_manager.html">libemb::TimerManager</a></div><div class="ttdoc">定时器管理器</div><div class="ttdef"><b>Definition:</b> Timer.h:97</div></div>
<div class="ttc" id="a_date_time_8h_html"><div class="ttname"><a href="_date_time_8h.html">DateTime.h</a></div><div class="ttdoc">日期时间</div></div>
<div class="ttc" id="aclasslibemb_1_1_timer_manager_html_a39ce6c9ee541c303d308ebfc3b41499f"><div class="ttname"><a href="classlibemb_1_1_timer_manager.html#a39ce6c9ee541c303d308ebfc3b41499f">libemb::TimerManager::registerTimer</a></div><div class="ttdeci">bool registerTimer(const Timer &amp;timer)</div><div class="ttdoc">注册定时器</div><div class="ttdef"><b>Definition:</b> Timer.cpp:71</div></div>
<div class="ttc" id="aclasslibemb_1_1_timer_manager_html_a0ffd07a8cfe9bb462968e0461e1b87f4"><div class="ttname"><a href="classlibemb_1_1_timer_manager.html#a0ffd07a8cfe9bb462968e0461e1b87f4">libemb::TimerManager::unregisterTimer</a></div><div class="ttdeci">bool unregisterTimer(const Timer &amp;timer)</div><div class="ttdoc">注销定时器</div><div class="ttdef"><b>Definition:</b> Timer.cpp:95</div></div>
<div class="ttc" id="aclasslibemb_1_1_event_timer_html"><div class="ttname"><a href="classlibemb_1_1_event_timer.html">libemb::EventTimer</a></div><div class="ttdoc">事件定时器类</div><div class="ttdef"><b>Definition:</b> Timer.h:172</div></div>
<div class="ttc" id="aclasslibemb_1_1_mutex_html"><div class="ttname"><a href="classlibemb_1_1_mutex.html">libemb::Mutex</a></div><div class="ttdoc">互斥锁类</div><div class="ttdef"><b>Definition:</b> ThreadUtil.h:43</div></div>
<div class="ttc" id="aclasslibemb_1_1_r_timer_html_a9a1f4ff5d6f67b82aa56cbee440acfe8"><div class="ttname"><a href="classlibemb_1_1_r_timer.html#a9a1f4ff5d6f67b82aa56cbee440acfe8">libemb::RTimer::RTimer</a></div><div class="ttdeci">RTimer(const TimerListener &amp;listener, int id)</div><div class="ttdoc">RTimer构造函数</div><div class="ttdef"><b>Definition:</b> Timer.cpp:123</div></div>
<div class="ttc" id="aclasslibemb_1_1_r_timer_html_a14a3671120ad948121f756f9f1ed0a40"><div class="ttname"><a href="classlibemb_1_1_r_timer.html#a14a3671120ad948121f756f9f1ed0a40">libemb::RTimer::start</a></div><div class="ttdeci">bool start(int usTimeout, int usTick, bool repeat=false)</div><div class="ttdoc">启动定时器</div><div class="ttdef"><b>Definition:</b> Timer.cpp:133</div></div>
<div class="ttc" id="aclasslibemb_1_1_r_timer_html_a8da735814c1121a8ef1b1af2c4ac0ed7"><div class="ttname"><a href="classlibemb_1_1_r_timer.html#a8da735814c1121a8ef1b1af2c4ac0ed7">libemb::RTimer::stop</a></div><div class="ttdeci">void stop()</div><div class="ttdoc">停止定时器</div><div class="ttdef"><b>Definition:</b> Timer.cpp:147</div></div>
<div class="ttc" id="aclasslibemb_1_1_timer_listener_html_a92d35491cd12d3f8b1fbec1fadfb3f7f"><div class="ttname"><a href="classlibemb_1_1_timer_listener.html#a92d35491cd12d3f8b1fbec1fadfb3f7f">libemb::TimerListener::onTimer</a></div><div class="ttdeci">virtual void onTimer(int timerID)=0</div><div class="ttdoc">定时回调函数</div></div>
<div class="ttc" id="aclasslibemb_1_1_event_timer_html_acd3bda3d463dd9e896ae8efc63d30c4a"><div class="ttname"><a href="classlibemb_1_1_event_timer.html#acd3bda3d463dd9e896ae8efc63d30c4a">libemb::EventTimer::waitEvent</a></div><div class="ttdeci">int waitEvent(std::vector&lt; int &gt; eventList, int usTimeout)</div><div class="ttdoc">等待事件</div><div class="ttdef"><b>Definition:</b> Timer.cpp:226</div></div>
<div class="ttc" id="a_singleton_8h_html_adbe81dabafd4a18fb17e8780c0a9190d"><div class="ttname"><a href="_singleton_8h.html#adbe81dabafd4a18fb17e8780c0a9190d">DECL_SINGLETON</a></div><div class="ttdeci">#define DECL_SINGLETON(InstanceClass)</div><div class="ttdef"><b>Definition:</b> Singleton.h:44</div></div>
<div class="ttc" id="aclasslibemb_1_1_timer_html_abea390d224f2ac79b3c20ccfa81c0214"><div class="ttname"><a href="classlibemb_1_1_timer.html#abea390d224f2ac79b3c20ccfa81c0214">libemb::Timer::stop</a></div><div class="ttdeci">void stop()</div><div class="ttdoc">停止定时器</div><div class="ttdef"><b>Definition:</b> Timer.cpp:25</div></div>
<div class="ttc" id="a_base_type_8h_html"><div class="ttname"><a href="_base_type_8h.html">BaseType.h</a></div><div class="ttdoc">基础类型头文件</div></div>
<div class="ttc" id="aclasslibemb_1_1_timer_html"><div class="ttname"><a href="classlibemb_1_1_timer.html">libemb::Timer</a></div><div class="ttdoc">定时器类</div><div class="ttdef"><b>Definition:</b> Timer.h:59</div></div>
<div class="ttc" id="aclasslibemb_1_1_r_timer_html"><div class="ttname"><a href="classlibemb_1_1_r_timer.html">libemb::RTimer</a></div><div class="ttdoc">实时定时器类(每个定时器独占一个线程)</div><div class="ttdef"><b>Definition:</b> Timer.h:129</div></div>
<div class="ttc" id="a_thread_8h_html"><div class="ttname"><a href="_thread_8h.html">Thread.h</a></div><div class="ttdoc">线程</div></div>
<div class="ttc" id="aclasslibemb_1_1_timer_html_a1e01bd9a8f9d9b779c0a89f8d5a60526"><div class="ttname"><a href="classlibemb_1_1_timer.html#a1e01bd9a8f9d9b779c0a89f8d5a60526">libemb::Timer::start</a></div><div class="ttdeci">bool start(int seconds, int repeats=-1)</div><div class="ttdoc">开启定时器</div><div class="ttdef"><b>Definition:</b> Timer.cpp:16</div></div>
<div class="ttc" id="aclasslibemb_1_1_timer_html_aa2d347668ffa5937cd47f4f6fb80b513"><div class="ttname"><a href="classlibemb_1_1_timer.html#aa2d347668ffa5937cd47f4f6fb80b513">libemb::Timer::id</a></div><div class="ttdeci">int id()</div><div class="ttdoc">获取定时器id</div><div class="ttdef"><b>Definition:</b> Timer.h:80</div></div>
<div class="ttc" id="aclasslibemb_1_1_runnable_html"><div class="ttname"><a href="classlibemb_1_1_runnable.html">libemb::Runnable</a></div><div class="ttdoc">线程运行体,子类必须重写run方法.</div><div class="ttdef"><b>Definition:</b> Thread.h:44</div></div>
<div class="ttc" id="aclasslibemb_1_1_event_timer_html_a85ec84b0477b1cf8b7fbb658e193d964"><div class="ttname"><a href="classlibemb_1_1_event_timer.html#a85ec84b0477b1cf8b7fbb658e193d964">libemb::EventTimer::clearEvent</a></div><div class="ttdeci">void clearEvent()</div><div class="ttdoc">清空事件</div><div class="ttdef"><b>Definition:</b> Timer.cpp:220</div></div>
<div class="ttc" id="aclasslibemb_1_1_timer_listener_html"><div class="ttname"><a href="classlibemb_1_1_timer_listener.html">libemb::TimerListener</a></div><div class="ttdoc">Timer定时器监听器接口</div><div class="ttdef"><b>Definition:</b> Timer.h:44</div></div>
<div class="ttc" id="a_base_type_8h_html_a57e803e49526dc5ba8c1915c68708ae0"><div class="ttname"><a href="_base_type_8h.html#a57e803e49526dc5ba8c1915c68708ae0">DECL_CLASSNAME</a></div><div class="ttdeci">#define DECL_CLASSNAME(ClassName)</div><div class="ttdef"><b>Definition:</b> BaseType.h:176</div></div>
<div class="ttc" id="aclasslibemb_1_1_r_timer_html_a7baba59b510de9da5458fbda682612c1"><div class="ttname"><a href="classlibemb_1_1_r_timer.html#a7baba59b510de9da5458fbda682612c1">libemb::RTimer::id</a></div><div class="ttdeci">int id()</div><div class="ttdoc">获取定时器ID</div><div class="ttdef"><b>Definition:</b> Timer.h:156</div></div>
<div class="ttc" id="aclasslibemb_1_1_singleton_html"><div class="ttname"><a href="classlibemb_1_1_singleton.html">libemb::Singleton</a></div><div class="ttdoc">单例模板类</div><div class="ttdef"><b>Definition:</b> Singleton.h:51</div></div>
<div class="ttc" id="aclasslibemb_1_1_event_timer_html_ab3d4af19969a3e9e8509524ca12fdeed"><div class="ttname"><a href="classlibemb_1_1_event_timer.html#ab3d4af19969a3e9e8509524ca12fdeed">libemb::EventTimer::EventTimer</a></div><div class="ttdeci">EventTimer(int usCheck, int evtMask=-1)</div><div class="ttdoc">事件定时器</div><div class="ttdef"><b>Definition:</b> Timer.cpp:204</div></div>
<div class="ttc" id="a_thread_util_8h_html"><div class="ttname"><a href="_thread_util_8h.html">ThreadUtil.h</a></div><div class="ttdoc">线程工具</div></div>
<div class="ttc" id="aclasslibemb_1_1_mutex_cond_html"><div class="ttname"><a href="classlibemb_1_1_mutex_cond.html">libemb::MutexCond</a></div><div class="ttdoc">条件变量</div><div class="ttdef"><b>Definition:</b> ThreadUtil.h:82</div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
</html>
